package org.yxjme.exbluetoothserver;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import androidx.annotation.Nullable;

public class BluetoothServer extends Service {

    private MyBinder binder ;

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        if (binder==null){
            binder = new MyBinder() ;
        }
        return binder;
    }


    @Override
    public void onCreate() {
        super.onCreate();
    }


    @Override
    public void onStart(Intent intent, int startId) {
        super.onStart(intent, startId);
    }


    @Override
    public boolean onUnbind(Intent intent) {
        return super.onUnbind(intent);
    }


    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }


    public class MyBinder extends Binder{

        public void init(Handler handler) {
            ServerBluetoothSocketUtil serverBluetoothSocketUtil = new ServerBluetoothSocketUtil(handler);
            serverBluetoothSocketUtil.init();
        }
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
